/*
 * InvoiceCatalog.java
 *
 * Created on April 29, 2007, 11:13 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package model;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Alirio
 */
public class InvoiceCatalog {
  private List invoices = new ArrayList();
  private double total;
  
  /** Creates a new instance of InvoiceCatalog */
  public InvoiceCatalog() {
  }

  private void computeTotal() {
    double acum = 0;
    for (Object elem : invoices) {
      acum += ((Invoice) elem).getBalance();
    }
    total = acum;
  }
  
  public void addInvoice(Invoice inv) {
    invoices.add(inv);
  }
  
  public List getInvoices() {
    return invoices;
  }

  public void setInvoices(List invoices) {
    this.invoices = invoices;
  }

  public double getTotal() {
    computeTotal();
    return total;
  }

  public void setTotal(double total) {
    this.total = total;
  }
  
}
